<%@page import="com.itwill.ecom.boardType.BoardTypeBeans"%>
<%@page import="com.itwill.ecom.company.CompanyBeans"%>
<%@page import="com.itwill.ecom.category.CategoryBeans"%>
<%@page import="java.util.List"%>
<%@page import="com.itwill.ecom.boardType.BoardTypeService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="com.itwill.ecom.company.CompanyService"%>
<%@page import="com.itwill.ecom.category.CategoryService"%>
<%@page import="com.itwill.ecom.category.CategoryServiceImpl"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>


	<div class="header-bottom">
		<div class="container">
			<div class="row">
				<div class="col-sm-9">
					<div class="navbar-header">
						<button type="button" class="navbar-toggle" data-toggle="collapse"
							data-target=".navbar-collapse">
							<span class="sr-only">Toggle navigation</span> <span
								class="icon-bar"></span> <span class="icon-bar"></span> <span
								class="icon-bar"></span>
						</button>
					</div>
					<div class="mainmenu pull-left">
						<ul class="nav navbar-nav collapse navbar-collapse">
							<li><a href="/ecom" class="active">홈</a></li>
							<li class="dropdown"><a href="#">제품목록<i class="fa fa-angle-down"></i></a>
								<ul role="menu" class="sub-menu">
								<%	
								
								//급해서 그냥 가라로 함
								WebApplicationContext webContext = WebApplicationContextUtils.getWebApplicationContext(application);
								CategoryService categoryService = (CategoryService)webContext.getBean("categoryService");
								CompanyService companyService = (CompanyService)webContext.getBean("companyService");
								BoardTypeService boardTypeService = (BoardTypeService)webContext.getBean("boardTypeService");
								
								List<CategoryBeans> categoryBeansList = categoryService.getCategoryAll();
								List<CompanyBeans> companyBeansList = companyService.getAllCompany();
								List<BoardTypeBeans> boardTypeBeansList = boardTypeService.getAllBoardType();
								
								for(int i=0; i<companyBeansList.size(); i++){
								%>
									<li><a href="${pageContext.request.contextPath}/product/companyList?companyno=<%= i+1 %>"><%= companyBeansList.get(i).getCompany_name() %></a></li>
								<%
								}
								%>
								
								<li><font color="white">────────────</font></li>
								
								<%
								for(int i=0; i<categoryBeansList.size(); i++){
								%>
									<li><a href="${pageContext.request.contextPath}/product/categoryList?categoryno=<%= i+1 %>"><%= categoryBeansList.get(i).getCategory_name() %></a></li>
								<%
								}
								%>
								
								<%--
									<li><a href="shop">제품</a></li>
									<li><a href="product_detail">제품 상세보기</a></li>
									<li><a href="checkout">로그아웃</a></li>
									<li><a href="cart/cartform">장바구니</a></li>
									<li><a href="login">로그인</a></li>
									 --%>
								</ul></li>
							<li class="dropdown"><a href="#">고객센터<i
									class="fa fa-angle-down"></i></a>
								<ul role="menu" class="sub-menu">
									<li><a href="${pageContext.request.contextPath}/board/boardlist?pageno=1&pagetype=1">QnA</a></li>
								</ul>
							</li>
							<li class="dropdown"><a href="#">커뮤니티<i
									class="fa fa-angle-down"></i></a>
								<ul role="menu" class="sub-menu">
									<%
									for(int i=0; i<boardTypeBeansList.size(); i++){
									%>
									<li><a href="${pageContext.request.contextPath}/board/boardlist?pageno=1&pagetype=<%= i+1 %>"><%= boardTypeBeansList.get(i).getBtype_name() %></a></li>
									<%
									}
									%>
								</ul>
							</li>

						</ul>
					</div>
				</div>
				
			</div>
		</div>
	</div>